package com.example.andylau96.res.DataBase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by AndyLau96 on 2016/12/2.
 */
public class UserDataBase extends SQLiteOpenHelper
{
    public final static int version = 1;
    public final static String dbName = "UserDataBase";
    public UserDataBase(Context context)
    {
        super(context,dbName,null,version);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        /**
         * 创建user表，并初始化各用户信息
         */
        db.execSQL("create table user (WorkId integer primary key,Password varchar,Permission integer)");
        db.execSQL("insert into user values(1582863860,'qian123',3)");
        db.execSQL("insert into user values(1,'1',1)");
        db.execSQL("insert into user values(2,'2',2)");
        db.execSQL("insert into user values(3,'3',3)");
        db.execSQL("insert into user values(4,'4',4)");
        db.execSQL("insert into user values(5,'5',5)");
        db.execSQL("insert into user values(6,'5',5)");
        db.execSQL("insert into user values(7,'5',5)");
        /**
         * 创建worker表，并初始化员工信息
         */
        db.execSQL("create table worker (WorkId integer primary key,Name varchar,Age integer,Tel varchar,Time varchar)");
        db.execSQL("insert into worker values(1582863860,'罗倩',20,'6666666666','0-0-0')");
        db.execSQL("insert into worker values(1,'张三',20,'1333333333','0-0-0')");
        db.execSQL("insert into worker values(2,'李四',20,'1444444444','0-0-0')");
        db.execSQL("insert into worker values(3,'王五',20,'1555555555','0-0-0')");
        db.execSQL("insert into worker values(4,'赵六',20,'1666666666','0-0-0')");
        db.execSQL("insert into worker values(5,'孙七',20,'1777777777','0-0-0')");
        db.execSQL("insert into worker values(6,'隔壁老王',20,'1777777777','0-0-0')");
        db.execSQL("insert into worker values(7,'王思聪',20,'1777777777','0-0-0')");
    }
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
